package com.xmlt.core.template.types;

public class BooleanValidator implements
		IChoiceValidator {

	private static final String[] choices = new String[] { "true", "false" };

	@Override
	public boolean validate(String value) {
		try {
			Boolean.parseBoolean(value);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	@Override
	public String getDisplayValue(String value) {
		return value;
	}

	@Override
	public Object getContentValue(String value) {
		try {
			return Boolean.parseBoolean(value);
		} catch (Exception e) {
		}
		return "";
	}

	@Override
	public String[] getChoices() {
		return choices;
	}

}
